<%--
  Created by IntelliJ IDEA.
  User: 32696
  Date: 2025/10/23
  Time: 23:53
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>练习题</title>
</head>
<body>
<h1>请输入答案</h1>
<form action="${pageContext.request.contextPath}/submitExercise" method="post">
    <c:forEach items="${problems}" var="problem" varStatus="status">
        <p>
                ${status.index + 1}. ${problem.question}
            <input type="number" name="answers" required>
                <%-- 隐藏域存储题目索引，用于匹配答案 --%>
            <input type="hidden" name="indices" value="${status.index}">
        </p>
    </c:forEach>
    <button type="submit">提交答案</button>
</form>
</body>
</html>
